package com.jbp.controller;

import java.util.Arrays;
import java.util.Map;



import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.jbp.model.UserBlack;
import com.jbp.service.UserBlackService;
import com.jbp.utils.PageUtils;
import com.jbp.utils.R;
import springfox.documentation.annotations.ApiIgnore;


/**
 * 
 *
 * @author lucheng feng
 * @email jbp@gmail.com
 * @date 2020-06-14 21:24:44
 */
@RestController
@ApiIgnore
@RequestMapping("/rest/userblack")
public class UserBlackController {
    @Autowired
    private UserBlackService userBlackService;

    /**
     * 列表
     */
    @GetMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = userBlackService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
        UserBlack userBlack = userBlackService.getById(id);

        return R.ok().put("userBlack", userBlack);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody UserBlack userBlack){
        userBlackService.save(userBlack);

        return R.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    public R update(@RequestBody UserBlack userBlack){
        userBlackService.updateById(userBlack);
        
        return R.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
        userBlackService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
